from typing import List


class Solution:
    def maxArea(self, height: List[int]) -> int:
        left_index = 0
        # left_max = height[0]
        right_index = len(height) - 1
        # right_max = height[right_index]
        max_water = 0
        while left_index < right_index:
            max_water  = max(max_water, min(height[left_index], height[right_index]) * (right_index - left_index))
            if height[left_index] < height[right_index]:
                left_index +=1
            else:
                right_index -= 1

        return max_water


height = [1,8,6,2,5,4,8,3,7]
print(Solution().maxArea(height))
